﻿using System;
using System.Web;
using System.Collections.Generic;
using System.Data;

public class Sessions
{
    public static Member CurrentMember
    {
        get
        {
            if (HttpContext.Current.Session["CurrentMember"] == null)
            {
                return new Member();
            }
            return (Member) HttpContext.Current.Session["CurrentMember"];
        }
        set
        {
            HttpContext.Current.Session["CurrentMember"] = value;
        }
    }

    public static DataTable SelectedProducts
    {
        get
        {
            if (HttpContext.Current.Session["SelectedProducts"] == null)
            {
                System.Data.DataTable dt = new System.Data.DataTable();
                dt.TableName = "SelectedProduct";
                dt.Namespace = "SelectedProducts";

                DataColumn[] dc = new DataColumn[2];
                dc[0] = dt.Columns.Add("ProductId", typeof(int));
                dc[1] = dt.Columns.Add("RollId", typeof(int));
                
                DataColumn col = new DataColumn("Qty",typeof(decimal));
                dt.Columns.Add(col);
                
                HttpContext.Current.Session["SelectedProducts"] = dt;
            }
            
            return (DataTable)HttpContext.Current.Session["SelectedProducts"];
        }
        set
        {
            HttpContext.Current.Session["SelectedProducts"] = value;
        }
    }

    public static string GlobalMessage
    {
        get
        {
            if (HttpContext.Current.Session["GlobalMessage"] == null)
            {
                return "";
            }

            return (string) HttpContext.Current.Session["GlobalMessage"];
        }
        set
        {
            HttpContext.Current.Session["GlobalMessage"] = value;
        }
    }

    public static object Season { get; set; }

    public static object Duration { get; set; }

    public static object Brand { get; set; }

    public static int RequestId { get; set; }

    public static string Notes { get; set; }

    public static string email { get; set; }

    public static string ReservedBy { get; set; }

    public static string OrderRef { get; set; }

    public static DataTable RezerveSummary { get; set; }

    public static string Order
    {
        get
        {
            if (HttpContext.Current.Session["Order"] == null)
            {
                return "";
            }

            return HttpContext.Current.Session["Order"].ToString();
        }
        set
        {
            HttpContext.Current.Session["Order"] = value;
        }
    }


    public static string DetailLevel
    {
        get
        {
            if (HttpContext.Current.Session["DetailLevel"] == null)
            {
                return "";
            }

            return HttpContext.Current.Session["DetailLevel"].ToString();
        }
        set
        {
            HttpContext.Current.Session["DetailLevel"] = value;
        }
    }

    public static string CurrentTab
    {
        get
        {
            if (HttpContext.Current.Session["CurrentTab"] == null)
            {
                return ".";
            }

            return HttpContext.Current.Session["CurrentTab"].ToString();
        }
        set
        {
            HttpContext.Current.Session["CurrentTab"] = value;
        }
    }
}

